var mongoose = require("mongoose");
var Schema = mongoose.Schema;

var user_schema = new Schema({
    name: String,
    password: String,
    age:Number,
    time:Date,
})

var mvs_schema = new Schema({
    "genres":Array,
    "casts":Array,
    "directors":Array,
    // "_id":String,
    "rating":Object,
    "title":String,
    "collect_count":Number,
    "original_title":String,
    "subtype":String,
    "year":String,
    "images":Object,
    "alt":String,
    "id":String
})

var comment_schema = new Schema({
    title:String,
    content:String,
    author:String,
    time:Date,
    mid:String,
    movie:Object,
    answer:Array
})

//用户添加
var prousers1_schema = new Schema({
    mobile:String,
    username:String,
    password:String,
    roleid:String,
    time:Date,
    avatar:String
})
exports.Prouser = mongoose.model("prousers1",prousers1_schema);

exports.Users = mongoose.model("users",user_schema);
exports.Mvs = mongoose.model("movies",mvs_schema);
exports.Comment = mongoose.model("comments",comment_schema);

//个人体温记录
var tiwen1_schema = new Schema({
    mobile:String,
    username:String,
    time:Date,
    tiwen:Number,
    ishei:String,
    is_yin:String  //1 阴性 2 阳性
})
exports.Tiwen = mongoose.model("tiwen1",tiwen1_schema);


//意见记录
var advise1_schema = new Schema({
    mobile:String,
    username:String,
    time:Date,
    title:String,
    content:String,
    category:String, // Array 收录意见分类的，存个数组会方便些（将错就错）
    reply:Array,
})
exports.Advise = mongoose.model("advise1",advise1_schema);

//商品列表
var good_schema = new Schema({
    "name" : String, 
    "price" :Number, 
    "discount" : Number, 
    "img" : String,
    "type" : Object
 })

 exports.Goods = mongoose.model("goods",good_schema);

 //添加购物商品到数据库
 var cart_schema = new Schema({
    "mobile":String,
    good:Object,
    goodId:String,
    count:Number,
    time:Date,
    checked:Boolean
 })

 exports.Cart = mongoose.model("cart1",cart_schema);

//添加电影票到数据库
var car_schema = new Schema({
"mobile":String,
list:Object,
filmId:String,
count:Number,
time:Date,
checked:Boolean,
price:Number,
})

exports.Car = mongoose.model("cars",car_schema);